# Copyright 2025 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""Generate data for test."""
import numpy as np


def get_init_params(input_size, output_size):
    # Generate initialization parameters
    np.random.seed(42)
    weight_shape = (input_size, output_size)
    return {
        "inputs": 0.01 * np.random.randn(2 * 2, input_size),
        "weight_tensor_input": 0.01 * np.random.randn(*weight_shape),
        "weight": 0.01 * np.random.randn(*weight_shape),
        "bias": 0.01 * np.random.randn(output_size)
    }

def get_legacy_data() -> dict[str, np.ndarray]:
    """Generate gpu data for test."""
    output_only = np.array(
        [[-3.14712524e-04, 1.01566315e-04, 1.08718872e-04, -1.80244446e-04,
          -5.22613525e-04, 4.21524048e-04, 6.37054443e-04, 4.46319580e-04,
          -1.74522400e-04, -1.25885010e-03, -7.40051270e-04, -7.01904297e-04,
          1.98364258e-04, 3.37600708e-04, -3.01361084e-04, 9.96589661e-05,
          -6.79016113e-04, 5.68389893e-04, -2.76565552e-04, 2.16484070e-04,
          8.23974609e-04, 3.50952148e-04, 8.05854797e-05, -8.15391541e-05,
          -6.90460205e-04, 1.21307373e-03, 6.40869141e-04, -8.34465027e-05,
          -1.93595886e-04, -3.22341919e-04, -2.30789185e-04, 4.71115112e-04],
         [-1.02996826e-03, -1.42097473e-04, -1.37329102e-03, 3.50952148e-04,
          1.07765198e-04, 1.86920166e-04, 1.85966492e-04, -3.70025635e-04,
          -1.62124634e-04, -2.08854675e-04, -3.52859497e-04, 2.78472900e-04,
          -4.78744507e-04, -2.72750854e-04, 3.54766846e-04, -3.98635864e-04,
          -7.24792480e-04, -2.49862671e-04, -5.72204590e-04, 4.07695770e-05,
          4.69207764e-04, 1.55448914e-04, -6.21795654e-04, 3.10897827e-04,
          1.40190125e-04, -1.28173828e-03, -3.62396240e-04, -5.41687012e-04,
          3.60488892e-04, 5.34057617e-04, 6.02722168e-04, -2.86102295e-04],
         [2.43186951e-04, -5.48362732e-05, 3.85284424e-04, 1.05381012e-04,
          -4.13894653e-04, 1.91688538e-04, -1.45912170e-04, 4.06265259e-04,
          -1.13248825e-05, 9.49859619e-04, -1.80244446e-04, -5.68389893e-04,
          -1.25885010e-04, -1.34468079e-04, -2.08854675e-04, 3.56674194e-04,
          -1.07574463e-03, -2.62260437e-06, -7.93457031e-04, 4.52041626e-04,
          -9.01222229e-05, 7.62939453e-04, -6.44683838e-04, 1.58309937e-04,
          8.88824463e-04, 3.93390656e-06, 5.91278076e-04, -6.98089600e-04,
          -6.10351562e-04, 7.62939453e-06, -6.02722168e-04, 3.24249268e-04],
         [-1.87873840e-04, -7.17163086e-04, 8.88824463e-04, 4.11272049e-06,
          1.95503235e-04, 2.67028809e-04, -2.46047974e-04, 2.01225281e-04,
          2.06232071e-05, 1.48773193e-04, 1.43432617e-03, 8.73565674e-04,
          -5.53131104e-04, 1.80244446e-04, 5.50746918e-05, 7.89642334e-04,
          -2.78472900e-04, 2.04086304e-04, -1.48415565e-05, 8.69750977e-04,
          -1.20162964e-04, -6.67572021e-04, 3.75747681e-04, 1.98364258e-04,
          -4.21524048e-04, -1.71661377e-04, -4.38690186e-04, 4.78744507e-04,
          5.53131104e-04, -2.15530396e-04, 2.76565552e-04, -4.13894653e-04]])

    output_with_bias = np.array(
        [[-1.64794922e-02, 1.94549561e-03, 2.03857422e-02, -1.12533569e-04,
          -2.42614746e-03, -3.14331055e-03, -1.16729736e-03, 1.41601562e-02,
          -2.22167969e-02, 1.40380859e-02, -1.49536133e-02, -3.37219238e-03,
          -4.11987305e-03, 6.22558594e-03, -1.62353516e-02, 4.69970703e-03,
          1.95312500e-02, -1.30615234e-02, 1.62506104e-03, -6.40869141e-03,
          5.09643555e-03, 5.41687012e-04, -6.31713867e-03, 4.79125977e-03,
          1.73339844e-02, -6.98089600e-04, 7.87353516e-03, -1.30004883e-02,
          -9.76562500e-03, 4.39453125e-03, 1.45874023e-02, 4.02832031e-03],
         [-1.70898438e-02, 1.70135498e-03, 1.89208984e-02, 4.19616699e-04,
          -1.79290771e-03, -3.38745117e-03, -1.61743164e-03, 1.33666992e-02,
          -2.22167969e-02, 1.51367188e-02, -1.45874023e-02, -2.39562988e-03,
          -4.79125977e-03, 5.61523438e-03, -1.56250000e-02, 4.21142578e-03,
          1.95312500e-02, -1.38549805e-02, 1.32751465e-03, -6.59179688e-03,
          4.73022461e-03, 3.47137451e-04, -7.01904297e-03, 5.18798828e-03,
          1.81884766e-02, -3.18908691e-03, 6.83593750e-03, -1.34887695e-02,
          -9.21630859e-03, 5.24902344e-03, 1.54418945e-02, 3.26538086e-03],
         [-1.58691406e-02, 1.79290771e-03, 2.06298828e-02, 1.73568726e-04,
          -2.31933594e-03, -3.37219238e-03, -1.94549561e-03, 1.41601562e-02,
          -2.20947266e-02, 1.62353516e-02, -1.44042969e-02, -3.23486328e-03,
          -4.42504883e-03, 5.76782227e-03, -1.62353516e-02, 4.97436523e-03,
          1.91650391e-02, -1.36108398e-02, 1.10626221e-03, -6.16455078e-03,
          4.18090820e-03, 9.53674316e-04, -7.04956055e-03, 5.03540039e-03,
          1.89208984e-02, -1.89971924e-03, 7.78198242e-03, -1.36108398e-02,
          -1.01928711e-02, 4.73022461e-03, 1.42211914e-02, 3.87573242e-03],
         [-1.63574219e-02, 1.12915039e-03, 2.11181641e-02, 7.24792480e-05,
          -1.70135498e-03, -3.31115723e-03, -2.04467773e-03, 1.39160156e-02,
          -2.20947266e-02, 1.54418945e-02, -1.28173828e-02, -1.80053711e-03,
          -4.85229492e-03, 6.07299805e-03, -1.59912109e-02, 5.40161133e-03,
          2.00195312e-02, -1.34277344e-02, 1.88446045e-03, -5.76782227e-03,
          4.15039062e-03, -4.74929810e-04, -6.04248047e-03, 5.06591797e-03,
          1.77001953e-02, -2.07519531e-03, 6.77490234e-03, -1.24511719e-02,
          -9.03320312e-03, 4.51660156e-03, 1.51367188e-02, 3.14331055e-03]])


    return {
        "output_only": output_only,
        "output_with_bias": output_with_bias,
    }

LEGACY_DATA = get_legacy_data()
